package org.suyafei.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.suyafei.service.TrafficService;

/**
 * @author 宿某人
 * @Date: 2022/03/17/17:51
 * @Description:
 */
@Component
@Slf4j
public class TrafficJobHandler {

    @Autowired
    private TrafficService trafficService;

    @XxlJob(value = "trafficExpiredHandler", init = "init", destroy = "destroy")
    public ReturnT<String> execute(String param) {
        log.info("触发定时任务：删除过期流量包");
        trafficService.deleteExpiredTraffic();
        return ReturnT.SUCCESS;
    }
    private void init() {
        log.info("MyJobHandler init");
    }

    private void destroy() {
        log.info("MyJobHandler destroy");

    }
}